package com.dt76.smallloanbackenduser.controller;


import com.dt76.smallloanbackenduser.pojo.huxuan.Vip;
import com.dt76.smallloanbackenduser.remote.huxuan.SetMatonRemote;
import com.dt76.smallloanbackenduser.remote.xiaohao.test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private test testRemote;
    @Autowired
    private SetMatonRemote setMatonRemote;

    @RequestMapping("/test")
    @ResponseBody
    public String test() {
        System.out.println("尝试远程调用");
        return testRemote.Test();
    }

    @GetMapping("/")
    public String index() {
        return "login";
    }

    @RequestMapping("/index")
    public String index1() {
        return "index";
    }

    @GetMapping("/basic_elements")
    public String good() {
        return "pages/set/basic_elements";
    }


    @GetMapping("/firstCheck")
    public String firstCheck() {
        return "pages/xm/firstCheck";
    }

    @GetMapping("/secondCheck")
    public String secondCheck() {
        return "pages/xm/secondCheck";
    }

    @GetMapping("/account")
    public String account() { return "pages/ysy/account"; }

    @GetMapping("/contractTemplate")
    public String contractTemplate(){
        return "pages/hzp/contractTemplate";
    }

    @GetMapping("/setmation")
    public String setMation(Model model) {
        System.out.println("查找用户协议内容");
        String agreement = setMatonRemote.qryAgreement();
        System.out.println(agreement+"!!!!!!!!!!");
        //System.out.println(file.getOriginalFilename());
        model.addAttribute("agreement",agreement);
        return "pages/hx/platform-set";
    }

    @GetMapping("/vipall")
    public String vipRank(Model model){
        System.out.println("进入！");
        List<Vip> vips = setMatonRemote.qryAll();
        for(Vip vip:vips){
            System.out.println("打印！！！！！！！！！！！");
            System.out.println(vip.toString());

        }
        model.addAttribute("vips",vips);
        return "/pages/hx/viprank";
    }

    @GetMapping("/msg")
    public String message(){
        return "/pages/hx/Notifications";
    }


}
